// LAMEFileDialog.cpp: implementation of the LAMEFileDialog class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "LAMEFileDialog.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

LAMEFileDialog::LAMEFileDialog()
{
}

LAMEFileDialog::~LAMEFileDialog()
{

}

bool LAMEFileDialog::initialize(HWND hWnd, TCHAR *filter, TCHAR *defExt)
{
	initialized=true;
	memset(&of,0,sizeof(of));
	memset(buffer,0,sizeof(buffer));
	of.lStructSize = sizeof(OPENFILENAME);
	of.hInstance = 0;
	of.hwndOwner = hWnd;//theApp->getHWND();

	of.lpstrFilter = filter;
	of.lpstrDefExt = defExt;
	of.lpstrFile = buffer;

	of.nMaxFile = 511;
	return true;
}

void LAMEFileDialog::showOpen()
{
	cancelled = false;
	memset(buffer,0,sizeof(buffer));
	//if (!initialized) return;
	of.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
	if (!GetOpenFileName(&of))   cancelled=true;
}

void LAMEFileDialog::showSave()
{
	cancelled=false;
	//if (!initialized) return;
	of.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
	if (!GetSaveFileName(&of))   cancelled=true;
}